package cn.edu.njpi.递归.乘阶;

/**
 * @author 朱宗辉
 * @version V1.0
 * @Package cn.edu.njpi.递归.乘阶
 * @date 2021/7/30 12:13
 */
public class Main {
    public static void main(String[] args) {
        int i = 5;
        System.out.println(i + "的阶乘为: " + chengJie(i));
    }

    public static int chengJie(int i) {
        if (i > 1) {
            return i * chengJie(i - 1);
        } else {
            return 1;
        }
    }
}
